package cn.ekuma.pos.toolcommand.base;

import com.openbravo.bean.Payment;
import com.openbravo.bean.ProductLotNoStockCurrent;
import com.openbravo.bean.ProductPrefPrice;
import com.openbravo.bean.ProductStockLevel;
import com.openbravo.bean.Rant;
import com.openbravo.bean.Receipt;
import com.openbravo.bean.Reservation;
import com.openbravo.bean.SharedProduct;
import com.openbravo.bean.StockCurrent;
import com.openbravo.bean.StockDiary;
import com.openbravo.bean.TaxLine;
import com.openbravo.bean.erp.OperationCustomer;
import com.openbravo.bean.erp.OperationCustomerCategory;
import com.openbravo.bean.erp.OperationProduct;
import com.openbravo.bean.erp.OperationProductCategory;
import com.openbravo.bean.erp.Order;
import com.openbravo.bean.erp.OrderLine;
import com.openbravo.bean.erp.OrderRelation;
import com.openbravo.bean.erp.OrderState;
import com.openbravo.bean.erp.SharedOrder;
import com.openbravo.bean.erp.TimeStore;
import com.openbravo.bean.erp.TimeStoreLine;
import com.openbravo.bean.sales.KitchenLine;
import com.openbravo.bean.sales.KitchenWorkLine;
import com.openbravo.bean.sales.Ticket;
import com.openbravo.bean.sales.TicketLine;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.loader.Transaction;
import com.openbravo.pos.bean.PaymentInfoTicket;

import net.xeoh.plugins.base.annotations.PluginImplementation;
import cn.ekuma.epos.toolcommand.AbstractCommand;

@PluginImplementation
public class ResetAppCommand extends AbstractCommand{
    public static  Class[] clearClass=new Class[]{
    	StockCurrent.class,
    	StockDiary.class,
    	ProductPrefPrice.class,
    	Rant.class,
    	Receipt.class,
    	Payment.class,
    	TaxLine.class,
    	Ticket.class,
    	TicketLine.class,
    	PaymentInfoTicket.class,
    	KitchenWorkLine.class,
    	KitchenLine.class,
    	Reservation.class,
    	ProductLotNoStockCurrent.class,
    	
    	SharedProduct.class,
    	Order.class,
    	OrderLine.class,
    	OrderState.class,
    	OrderRelation.class,
    	TimeStore.class,
    	TimeStoreLine.class,
    	OperationProductCategory.class,
    	OperationProduct.class,
    	ProductStockLevel.class,
     	OperationCustomerCategory.class,
     	OperationCustomer.class,
     	SharedOrder.class
    };
	
	@Override
	public String getCommandName() {
		return "Reset App";
	}

	@Override
	public String getCommandCategoryName() {	
		return "base";
	}

	@Override
	public void call() throws BasicException {
		Transaction t = new Transaction(s) {
            public Object transact() throws BasicException {
            	for(int i=clearClass.length;i>0;i--)
            	   dataLogic.clear(clearClass[i-1]);
            	return null;
            }
		};
       t.execute();     
	}
}
